// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once

#ifndef _WIN32_WINNT		// Allow use of features specific to Windows XP or later.                   
#define _WIN32_WINNT 0x0501	// Change this to the appropriate value to target other versions of Windows.
#endif						

#include <stdio.h>
#include <assert.h> 
#include <malloc.h>

typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned short WCHAR;
typedef unsigned int DWORD;

typedef unsigned short USHORT;
typedef unsigned char	  u8;
typedef unsigned short u16;
typedef unsigned long	  u32;
typedef signed char		  s8;
typedef signed short	  s16;
typedef signed long		  s32;


#ifndef WIN32_DEBUG
#include <android/log.h>
#define LOG_MODULE "===BDD==="
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_MODULE,__VA_ARGS__)
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG  , LOG_MODULE,__VA_ARGS__)
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO   , LOG_MODULE,__VA_ARGS__)
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN   , LOG_MODULE,__VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR  , LOG_MODULE,__VA_ARGS__)
#else
#define LOGV(...)
#define LOGD(...)
#define LOGI(...)
#define LOGW(...)
#define LOGE(...)
#endif



#define BNewMemory(a)		((void*)malloc(a))
#define BNewMemoryEx(a, b) ((a*)malloc(sizeof(a)*(b)))
#define BDeleteMemory(a)	(free(a))

typedef void FILE_HANDLE;//for bxc encode

typedef FILE_HANDLE _HFILE;

#define openApp_file(a) (fopen(a, "rb"))
//#define closeApp_file(a) (fclose(a)) besta_data_decoder_close
//#define closeApp_file(a) (besta_data_decoder_close(a))
//#define ReadAppFile(file, buffer, size) (besta_data_decoder_read(file,buffer,size))


//#define openApp_file(a) (fopen(a, "rb"))
#define closeApp_file(a) (fclose(a))
#define ReadAppFile(file, buffer, size) (fread(buffer, 1, size, file))
#define BDebugMessage(str) printf(str)
#define ASSERT(a) assert(a)

#define BOOL	int
#define TRUE	1
#define FALSE   0

#define ABS(a)     ((a) >= 0  ? (a) : -(a))

/************************************************************************/
/*  Define filling polygon method										*/
/************************************************************************/

#define FIXEDPOINT_METHOD

#ifdef FIXEDPOINT_METHOD
typedef int	 FIXEDPOINT;
#define POLYGON_FIX_SHIFT 8	
#define VALUE0_5		  0 
#endif

#if !defined(FLOAT_METHOD) && !defined(FIXEDPOINT_METHOD)
#error "FLOAT_METHOD or FIXEDPOINT_METHOD not define"
#endif
#if defined(FLOAT_METHOD) && defined(FIXEDPOINT_METHOD)
#error "FLOAT_METHOD and FIXEDPOINT_METHOD can't define in the same time"
#endif

// TODO: reference additional headers your program requires here
